<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
    </div>

</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {},
        methods: {

        }
    })
</script>

</html>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>

    <div id="box">
        <tabbar :text="home" :show-home="flag"></tabbar>
        <tabbar :text="detail" :show-home="true"></tabbar>
        <tabbar :text="cart"></tabbar>
    </div>
    <script>
        Vue.component("tabbar", {
            template: `
                <div style="background:blue;color:white;">
                    <button v-if="showHome">返回</button>
                    <span>导航->{{text}}</span>
                    <button>登录</button>
                </div>
            `,
            props: {
                text: {
                    type: String,
                    default: "默认值"
                },
                showHome: {
                    type: Boolean,
                    default: true
                }
            }
        })


        var vm = new Vue({
            el: "#box",
            data: {
                home: "首页",
                detail: "详情",
                cart: "购物车",
                flag: false
            }
        })
    </script>


</body>

</html>